import 'package:flutter_base/common/utils/utils.dart';
import 'package:flutter_base/common/values/colors.dart';
import 'package:flutter/material.dart';

///详情标题
Widget title({
  required String title,
  required String userName,
   String? deptName,
}) {
  return Container(
    color: Colors.white,
    child: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Padding(
          padding: const EdgeInsets.fromLTRB(20, 12, 12, 12),
          child: Text(
            title,
            style: TextStyle(
              fontSize: 22,
              fontWeight: FontWeight.w500,
            ),
          ),
        ),
        Padding(
          padding: const EdgeInsets.fromLTRB(20, 0, 12, 12),
          child: Row(
            children: [
              Container(
                margin: EdgeInsets.only(right: 5),
                width: zhiSetWidth(20),
                height: zhiSetWidth(20),

                //边框设置
                decoration: new BoxDecoration(
                  //背景
                  color: AppColors.primaryElement,
                  //设置四周圆角 角度
                  borderRadius: BorderRadius.all(Radius.circular(6.0)),
                  //设置四周边框
                ),
                child: Center(
                  child: Text(
                    nickName(userName),
                    style: TextStyle(
                        fontSize: 8,
                        color: Colors.white,
                        fontWeight: FontWeight.w500),
                  ),
                ),
              ),
              Row(
                children: [
                  Text('由$userName提交'),
                  // isEmpty(deptName)?Container():Text('（$deptName）'),
                ],
              ),
            ],
          ),
        ),
        // Padding(
        //   padding:
        //       const EdgeInsets.fromLTRB(20, 0, 12, 20),
        //   child: Text('审批通过'),
        // )
      ],
    ),
  );
}

///退回提示
Widget backText(String text) {
  return FractionallySizedBox(
    widthFactor: 1,
    child: Container(
      decoration: BoxDecoration(
        border: Border(bottom: BorderSide(color: Color(0xffd5caca), width: 0)),
        color: Color(0xfffbeeed),
      ),
      child: Row(
        children: <Widget>[
          SizedBox(
            width: 10,
          ),
          Padding(
            padding: const EdgeInsets.all(10.0),
            child: Icon(
              Icons.info,
              color: Color(0xffe75d58),
            ),
          ),
          Expanded(
              child: Padding(
            padding: const EdgeInsets.all(5.0),
            child: Text(
              '$text',
              style: TextStyle(color: Color(0xff645f5f)),
            ),
          ))
        ],
      ),
    ),
  );
}
